package com.example.dao;

import com.example.model.Borrow;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface BorrowDao {
    @Insert("insert into borrow (id,book_id,user_id,borrow_date,return_date) values (#{borrow.id},#{borrow.book_id},#{borrow.user_id},#{borrow.borrow_date},#{borrow.return_date})")
    void borrowBook(@Param("borrow") Borrow borrow);

    @Delete("delete from borrow where id = #{id}")
    void returnBook(int borrowId);

    Borrow getBorrowById(int borrowId);
}

